package com.woniuxy.warehouse.rabbitmq;

import com.woniuxy.commons.rabbit.RabbitMqConst;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * @ClassName Consumer
 * @Description rabbitmq消费者
 * @Author xianhao
 * @Date 2022/4/28 11:22
 * @Version 1.0.0
 */
@Component
public class Consumer {

    //接收采购单审核的消息
    @RabbitListener(queues = RabbitMqConst.PURCHASE_ORDER_ROUTING_OK_KEY)
    public void receiveOK(String purchaseOrderId) {
        //接收到消息
        System.out.println("消费者接收到---->成功消息：" +  Integer.parseInt(purchaseOrderId));
    }

    //接收采购单反审核的消息
    @RabbitListener(queues = RabbitMqConst.PURCHASE_ORDER_ROUTING_CANCEL_KEY)
    public void receiveCancel(String purchaseOrderId) {
        //接收到消息
        System.out.println("消费者接收到---->取消消息：" + Integer.parseInt(purchaseOrderId));
    }
}
